package top.zlcode.system.controller.user;

import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.zlcode.common.core.controller.BaseController;
import top.zlcode.common.core.domain.R;
import top.zlcode.common.core.domain.TableDataInfo;
import top.zlcode.system.domain.user.dto.UserDTO;
import top.zlcode.system.domain.user.dto.UserQueryDTO;
import top.zlcode.system.service.user.IUserService;

@RestController
@RequestMapping("/user")
public class UserController extends BaseController {

    @Autowired
    private IUserService userService;

    @GetMapping("/list")
    @Operation(summary = "查询用户接口", description = "根据 userQueryDTO 参数查询用户")
    public TableDataInfo list(UserQueryDTO userQueryDTO) {
        return getTableDataInfo(userService.list(userQueryDTO));
    }

    @PutMapping("/updateStatus")
    @Operation(summary = "更改用户状态", description = "根据 userQueryDTO 参数查询用户")
    public R<Void> updateStatus(@RequestBody UserDTO userDTO) {
        return toR(userService.updateStatus(userDTO));
    }
}
